<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>修改密码</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
    <style>
        #LAY_layedit_1{ height: 200px!important;}
    </style>
</head>

<body>
<div style="margin: 15px;">

    <form class="layui-form" action="">
        <section class="layui-larry-box">
            <div class="larry-personal">
                <div class="larry-personal-body clearfix changepwd">
                    <form class="layui-form col-lg-4" method="post" action="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户名</label>
                            <div class="layui-input-block" style="width: 300px;">
                                <input type="text" name="title" autocomplete="off" class="layui-input" value="admin" >
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">旧密码</label>
                            <div class="layui-input-block"  style="width: 300px;">
                                <input type="password" name="title" autocomplete="off" class="layui-input" value="" placeholder="请输入旧密码">
                            </div>
                        </div>
                        <div class="layui-form-item" >
                            <label class="layui-form-label">新密码</label>
                            <div class="layui-input-block" style="width: 300px;">
                                <input type="password" name="title" autocomplete="off" class="layui-input" value="" placeholder="请输入新密码">
                            </div>
                        </div>
                        <div class="layui-form-item" >
                            <label class="layui-form-label">确认密码</label>
                            <div class="layui-input-block" style="width: 300px;">
                                <input type="password" name="title" autocomplete="off" class="layui-input" value="" placeholder="请输入确认新密码">
                            </div>
                        </div>
                        <div class="layui-form-item change-submit">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </section>
    </form>
</div>
<script type="text/javascript" src="plugins/layui/layui.js"></script>
<script>
    layui.use(['form'], function() {
        var form = layui.form(),
                layer = layui.layer;

        //自定义验证规则
        form.verify({
            police: function(value) {
                if(value.length < 4) {
                    return '标题至少得4个字符啊';
                }
            },
            pass: [/(.+){6,12}$/, '密码必须6到12位'],
            content: function(value) {
                layedit.sync(editIndex);
            }
        });

        //监听提交
        form.on('submit(branch)', function(data) {
            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })
            return false;
        });
    });
</script>
</body>

</html>